package net.hvacapp.cmvrfforandroid.ui.product.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import net.hvacapp.cmvrfforandroid.R;

/**
 * Created by zhangnorman on 15/8/8.
 */
public class PropertyItemView extends LinearLayout {

    private LinearLayout mContentLl;
    private TextView mTitleTv;
    private TextView mDescTv;

    public PropertyItemView(Context context) {
        super(context);
        init(context, 0);
    }

    public PropertyItemView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init(context, 0);
    }

    public PropertyItemView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init(context, defStyle);
    }

    public void hideValueTextView() {
        mDescTv.setVisibility(INVISIBLE);
    }

    public void setItemOnClickListener (OnClickListener listener) {
        mContentLl.setOnClickListener(listener);
    }

    public void setTitleString(String title) {
        mTitleTv.setText(title);
    }

    public void setValueString(String desc) {
        mDescTv.setText(desc);
    }


    private void init(Context context, int defStyle) {
        LayoutInflater.from(context).inflate(R.layout.property_cell_item, this,
                true);
        mTitleTv = (TextView) findViewById(R.id.tv_name);
        mDescTv = (TextView) findViewById(R.id.tv_value);
        mContentLl = (LinearLayout) findViewById(R.id.ll_content);
    }
}
